'use strict';

const BaseController = require('../base');

class TravelController extends BaseController {
  static get serviceName() {
    return 'business.travel';
  }
  async destinationCityGroup() {
    const { category_id } = this.ctx.query;
    if (!category_id) {
      this.ctx.success([])
    }
    const list = await this.ctx.model.Business.Travel.findAll({
      where: {
        category_id,
      },
      attributes: ['destination_city'],
      group: ['destination_city']
    })
    this.ctx.success(list.map(item => item.destination_city))
  }
}

module.exports = TravelController; 